# encoding: utf-8
# @project: st2111 
# @file: selenium_example11.py
# @time: 2023/6/1 16:05
# @author: abcque
# @license: (C) Copyright 2013-2021
# @contact: abcque@outlook.com
# @IDE: PyCharm
# @desc:
import time

from selenium import webdriver
from selenium.webdriver import Keys, ActionChains
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.common.by import By

if __name__ == "__main__":
    url = "https://www.jd.com"
    executable_path = "../drivers/chromedriver.exe"

    service = Service(executable_path=executable_path)
    brower = webdriver.Chrome(service=service)

    brower.maximize_window()

    brower.get(url=url)
    # 执行 javascript 代码
    # brower.execute_script("window.open()")
    # brower.execute_script("window.open('https://www.baidu.com')")
    # 滚动页面，正数向右向下
    brower.execute_script("window.scroll(0,800)")
    time.sleep(5)
    brower.execute_script("window.scroll(0,-800)")

    time.sleep(10)

    brower.quit()